#include <xp/bas/str.h>
#include <xp/bas/stdio.h>

int xp_main ()
{
	xp_str_t str;

	if (xp_str_open(&str, 1) == XP_NULL) {
		xp_printf (XP_TEXT("cannot open a string\n"));
		return -1;
	}

	xp_printf (XP_TEXT("%ld\n"), xp_str_cat (&str, XP_TEXT("0123456789")));
	xp_printf (XP_TEXT("%ld\n"), xp_str_cat (&str, XP_TEXT("itisnice")));
	xp_printf (XP_TEXT("%ld\n"), xp_str_cat (&str, XP_TEXT("it is nice")));

	xp_printf (XP_TEXT("%ld, %ld\n"), xp_str_len(&str), xp_str_capa(&str));
	xp_printf (XP_TEXT("[%s]\n"), XP_STR_BUF(&str));

	xp_printf (XP_TEXT("%ld\n"), xp_str_del (&str, 10, 3000));
	xp_printf (XP_TEXT("%ld, %ld, [%s]\n"), 
		xp_str_len(&str), xp_str_capa(&str), xp_str_buf(&str));

	xp_str_close (&str);
	return 0;
}
